<template>
  <div>
    <div class="pageMain-title">
      <div
        style="display: flex;justify-content: space-between;font-size: 16px;margin: 0 20px;">
        <span>订单编号: {{ formData.code }}</span>
        <span>提交时间: {{ formData.submitTime }}</span>
        <span>评审类型: {{ formData.isHead == 1 ? "首评" : "复评" }}</span>
      </div>
    </div>
    <div class="pageMain-body" style="height: calc(100vh - 230px)">
      <div class="container">
        <!-- 左侧详情 -->
        <div class="left-half">
          <OrderDetail :show-detail="false" :form-data="formData"></OrderDetail>
        </div>
        <div class="vertical-line"></div>
        <!-- 右侧评价 -->
        <div class="right-half">
          <div class="majorCategories">
            <h3>技术评审人员意见</h3>
            <div class="majorCategories-main">
              <el-table :data="tableData" border>
                <el-table-column label="评审部门" prop="department" width="200">
                </el-table-column>
                <el-table-column label="评审人" prop="assessor" width="200">
                </el-table-column>
                <el-table-column label="评审意见" prop="comment">
                </el-table-column>
              </el-table>
              <!-- 成本变化 -->
              <table class="uTable" style="margin: 10px 0">
                <tbody>
                  <tr>
                    <td style="width: 180px"><span>是否引起成本变化</span></td>
                    <td>
                      {{ orderDetails.isCostByChange == null ? "" : orderDetails.isCostByChange == 0 ? "否" : "是" }}
                    </td>
                  </tr>
                  <tr>
                    <td><span>首试制</span></td>
                    <td>{{ orderDetails.isMake == null ? "" : orderDetails.isMake == 0 ? "否" : "是" }}</td>
                  </tr>
                  <tr>
                    <td><span>风险评估等级</span></td>
                    <td>
                      {{
                        orderDetails.assess == null ? "" : orderDetails.assess == 0
                          ? "高"
                          : orderDetails.assess == 1
                          ? "中"
                          : "低"
                      }}
                    </td>
                  </tr>
                  <tr>
                    <td><span>外委情况</span></td>
                    <td>{{ orderDetails.outsourcingStatus == null ? "" : orderDetails.outsourcingStatus == 0 ? "无需外委" : "需要外委" }}</td>
                  </tr>
                </tbody>
              </table>
              <div>
                <span>成本预测：</span>
                <el-button type="text" size="medium">
                  测算详情
                </el-button>
              </div>
              <div style="margin: 10px 0">
                <div>
                  <span>评审结论：</span>
                  <span>
                    {{ orderDetails.receivingState ? orderDetails.receivingState == 0 ? "不接单" : orderDetails.receivingState == 1 ? "接单" : orderDetails.receivingState == 2 ? "带条件生产" : "" : "" }}
                  </span>
                </div>
                <div v-if="orderDetails.receivingState && orderDetails.receivingState==2" style="margin: 10px 0">
                  <span>评审备注：</span>
                  <span>{{ orderDetails.receivingRemark }}</span>
                </div>
              </div>
            </div>
          </div>
          <div class="majorCategories">
            <h3>主任综合意见</h3>
            <div class="majorCategories-main">
              <h4>总工办/技术中心主任/副主任意见</h4>
              <p class="director-idea">
                {{ remark }}
              </p>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import OrderDetail from "@/components/OrderDetail.vue";
export default {
  components: { OrderDetail },
  props: {
    formData: {
      type: Object,
      default: () => {}
    },
    orderDetails: {
      type: Object,
      default: () => {}
    },
    suggest: {
      type: Object,
      default: () => {}
    }
  },
  data() {
    return {
      remark: ""
    };
  },
  computed: {
    tableData() {
      return this.orderDetails?.reviewInfoDtoList || [];
    }
  },
  watch: {
    suggest: {
      handler(newVal, oldVal) {
        if (newVal) {
          if (newVal.isConsent == 1) {
            this.remark = "同意," + newVal.remark;
          } else if (newVal.isConsent == 0) {
            this.remark = "不同意," + newVal.remark;
          }
        } else {
          this.remark = "";
        }
      },
      deep: true
    }
  }
};
</script>

<style lang="scss">
.vertical-line {
  width: 2px;
  height: 100%;
  background-color: #ccc;
  margin: 0 10px;
}
.container {
  display: flex;
  align-items: stretch;
  height: 100%;
}
.left-half {
  flex: 1;
  padding: 10px;
  margin: 30px 30px;
}
.right-half {
  flex: 1;
  padding: 10px 30px;
}
.pageMain-title {
  width: 80%;
  margin: auto;
}
.majorCategories {
  width: 100%;
  clear: both;
  .majorCategories-main {
    margin-top: 6px;
    margin-bottom: 16px;
    width: 94%;
    float: right;
  }
}
.director-idea {
  margin: 10px 0;
}
</style>
